PrintPRO 8 for ActiveX - User Guide > How To > Print Preview |
PrintPRO™ lets you create a print preview image for any document page.
You can create print preview images only or you can simultaneously create print preview images while printing a document. Set the PrintPreviewOnly Property to True if you only want to create print preview images. If you plan on creating print preview images while printing a document, you need to start a print document using the StartPrintDoc Method before initiating a print preview.
To initiate a print preview, you must call the StartPrintPreview Method. After initiating a print preview, continue to create the document to print. Use the EndPrintPreview Method to end the print preview. If you are creating a multiple page document, PrintPRO will automatically create a print preview for each page.
When you want to view a print preview for a page, you first need to determine the size of the print preview image using the PrintPreviewScale Property. Next, use the GetPrintPreview Method to create a bitmap image for the page you want to view. Finally, use the PrintPreviewPicture Property, PrintPreviewDIB Property, or PrintPreviewDDB Property to export the print preview image.
Print preview requires system resources that PrintPRO automatically takes care of. You can, however, delete the print preview resources yourself. The DelPrintPreviewPicture Method deletes the print preview bitmap image. You can always recreate the bitmap using the GetPrintPreview Method, so deleting the bitmap image when it is no longer needed will conserve system resources.
The DelPrintPreview Method deletes the print preview resources for a page. If you delete the print preview resources, you cannot recreate the bitmap image for that page.
Example |
Copy Code
|
---|---|
'The following code creates a simple print preview of a single line of text. An ImagXpress® control is used to display the image. PrintPRO1.PrintPreviewOnly = True PrintPRO1.StartPrintPreview PrintPRO1.PrintText "Print Preview Page 1" PrintPRO1.EndPrintPreview PrintPRO1.GetPrintPreview 1 ImagXpress.Picture = PrintPRO1.PrintPreviewPicture |
If you want to draw directly to the print preview Device Context (DC), use the hMetaDC Property to obtain the DC.